package com.moyun.controller.system;


import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.moyun.common.annotation.OperLog;
import com.moyun.common.aspect.BusinessType;
import com.moyun.controller.common.CommonController;
import com.moyun.model.common.R;
import com.moyun.model.po.dict.SysDictItem;
import com.moyun.service.dict.SysDictItemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 字典明细表 前端控制器
 * </p>
 *
 * @author yangbx
 * @since 2022-06-18
 */
@Api(tags = "字典数据")
@RestController
@RequiredArgsConstructor
@RequestMapping("/dict/sysDictItem")
public class SysDictItemController {

    private final SysDictItemService sysDictItemService;

    @ApiOperation("添加数据(增)")
    @ApiOperationSupport(order = 1)
    @OperLog(operModul = "", operType = BusinessType.INSERT, operDesc = "")
    @PostMapping("save")
    public R save(@RequestBody @Validated SysDictItem entity) {
        boolean isSave = this.sysDictItemService.save(entity);
        return isSave ? R.ok(0, "操作成功") : R.error(1, "操作失败");
    }

}

